package controlleur;

import java.util.logging.Level;
import java.util.logging.Logger;
import landinggearsystem.Software;

public class roue_control implements Runnable{

	Software s;
	boolean fin = false;
	boolean haut;

	public roue_control(Software software)
	{
		s=software;
	}

	public void setHaut(boolean haut) {
		this.haut = haut;
	}


	public void update() {
		if(haut==true)
		{
			//lever roue
			if(s.roue.lever_roue()==false)fin=true;

			System.out.println("lever roue - roue_control");
		}
		else
		{
			//baisser roue
			if(s.roue.baisser_roue()==false)fin=true;
			System.out.println("baisser roue - roue_control");
		}

	}

	@Override
	public void run() {
		while(fin==false)
		{
			update();
			try {
				Thread.sleep(50);    
			} catch (InterruptedException ex) {
				Logger.getLogger(roue_control.class.getName()).log(Level.SEVERE, null, ex);
			}
		}
		fin=false;
	}

}